﻿Imports System.Collections
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized

Namespace ViewModels

    ''' <summary>
    ''' Représente un item actionnable depuis une vue
    ''' </summary>
    ''' <remarks></remarks>
    Public Class ViewModelCommand
        Inherits ViewModelBase

        Public Sub New(ByVal displayName As String, ByVal command As ICommand)
            If command Is Nothing Then
                Throw New ArgumentNullException("command")
            End If
            MyBase.DisplayName = displayName
            Me.Command = command
        End Sub

        Private _command As ICommand
        Public Property Command() As ICommand
            Get
                Return _command
            End Get
            Private Set(ByVal value As ICommand)
                _command = value
            End Set
        End Property
    End Class

    ''' <summary>
    ''' Représente un item actionnable depuis une vue et contenant un sous-ensemble d'items actionnables également
    ''' </summary>
    ''' <remarks></remarks>
    Public Class ViewModelCommandGroup
        Inherits ViewModelCommand

        Public Sub New(ByVal displayName As String, ByVal command As ICommand, ByVal viewModelCommandChild As ObservableCollection(Of ViewModelCommand))
            MyBase.New(displayName, command)
            Me.ViewModelCommandChilds = viewModelCommandChild
        End Sub

        Private _ViewModelCommand As ObservableCollection(Of ViewModelCommand)
        Public Property ViewModelCommandChilds() As ObservableCollection(Of ViewModelCommand)
            Get
                Return _ViewModelCommand
            End Get
            Private Set(ByVal value As ObservableCollection(Of ViewModelCommand))
                _ViewModelCommand = value
            End Set
        End Property
    End Class

End Namespace
